
var fs = require('fs');
var path = require('path');
var uglifyjs = require('uglify-js');
var glob = require('glob');
var copy = require('copy');
var async = require('async');
var dirname = './test';
var destname = './test2';
var options = {
	compress : true
};
function copy(src, desc) {

}
glob( dirname+'/**/*', function( err, files ) {
   if(!err) {
   		async.each(files, function(file){
   			var extname = path.extname(file);
   			if(extname == '.js') {

   				var result = uglifyjs.minify(fs.readFileSync('./test/pages/test/test.js')
, options);
   				console.log(result.error);
   				// fs.writeFile(file, result.code, function(err){
   				// 	console.log(err);
   				// });
   			} 

   		},function(err,result){
   			console.log('each success')
   		});
   		
  //  		var result = UglifyJS.minify(code, options);
		// if (result.error) throw result.error;
   }
});


